// JavaScript Document

/////////////////////////////////////////////////////////////////////////////
//PJS
var PJS = new Object();
PJS.VERSION = "1.0.0.1";
PJS.AUTHOR = "jianyu";
PJS.COPYRIGHT = "PPEMI.COM";
PJS.BASE_URL = BASE_URL;
PJS.USER_AGENT = window.navigator.userAgent.toLowerCase();
PJS.IS_OPERA = (PJS.USER_AGENT.indexOf("opera")!=-1); 
PJS.IS_IE = ((PJS.USER_AGENT.indexOf("msie")!=-1)&&((document.all&&!PJS.IS_OPERA))); 
PJS.IS_MOZILLA = (PJS.USER_AGENT.indexOf("gecko")!=-1); //is that right?
PJS.IS_NS = (navigator.appName == "Netscape") ? 1 : 0;
/////////////////////////////////////////////////////////////////////////////
//METHODS
PJS.$E = function(el){
	if(document.getElementById){
		return document.getElementById(el);
	} else if(document.layers){
		document.layers[el];
	} else {
		return eval("document.all."+el);
	}
};
PJS.goto = function(url){
	document.location.href = PJS.BASE_URL+url;
};
PJS.redirect = function(url){
	document.location.href = url;
};
PJS.refresh = function(){
	document.location.href = document.location.href;
};
PJS.ltrim = function(str){
	return str.replace(/(^[\s]*)/g,"");
};
PJS.rtrim = function(str){
	return str.replace(/([\s]*$)/g,"");
};
PJS.trim = function(str){
	return str.replace(/(^[\s]*)|([\s]*$)/g,"");
};
PJS.rand = function(p,a,b){
	p = isUndefined(p) ? "" : p;
	if(a){
		b = b ? b:0;
		return p+"_"+Math.floor(Math.random()*a+b);
	} else {
		a = new Date();
		return p+"_"+a.getTime();
	}
};
PJS.inArray = function(valueToCheck,list){
	for(var i=0; i<list.length; i++){
		if(this[i] == valueToCheck ) return true;
	}
	return false;
};
//translate string to unicode list
PJS.encodeToArray = function(str){
	if(string == null || str.length == 0){
		return null;
	}
	var strlen = str.length;
	var strs = Array();
	for(var i=0; i<strlen; i++){
		strs[i] = str.charCodeAt(i);
	}
	
	return strs;
};
//translate unicode list to string 
PJS.decodeToString = function(strs){
	if(strs == null || strs.length == 0){
		return null;
	}
	var str = "";
	var listlen = strs.length;
	for(var i=0; i<listlen; i++){
		str += String.fromCharCode(strs[i]);
	}
	return str;
};
PJS.checkEmail = function(val){
	var emailPattern = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if(emailPattern.test(val) == false){
		return false;
	} else {
		return true;
	}
};
PJS.getCookie = function(name){
	var pattern = name+"=";
	if(document.cookie.length > 0){
		var offset = document.cookie.indexOf(pattern);
		if(offset != -1){
			offset += pattern.length;
			sEnd = document.cookie.indexOf(";",offset);
			if(sEnd == -1) sEnd = document.cookie.length;
			return unescape(document.cookie.substring(offset,sEnd));
		}
	}
	return "";
};
PJS.addLoadEvent = function(func){
	var oldonload = window.onload;
	if(typeof window.onload != "function"){
		window.onload = func;
	} else {
		window.onload = function(){oldonload();func();}
	}
};
PJS.addLoadScript = function(){
	var a = arguments;
	if(a.length == 0 ) return;
	var func = function(){
		for(var i=0; i<a.length; i++){
			var b = a[i];
			if(!b || b.length == 0 ) continue;
			if(b.indexOf("js/") == -1 ) b = "js/"+b;
			if(b.indexOf(".js") == -1 ) b += ".js";
			PJS.addScriptAlone(b);
		}
	};
	PJS.addLoadEvent(func);
};
PJS.include = function(sFileName){
	var objHead = document.getElementsByTagName("head");
	var objScript = document.createElement("script");
	objScript.type = "text/javascript";
	objScript.src = PJS.BASE_URL+sFileName;
	objHead[0].appendChild(objScript);
};
PJS.load = function(sFileName){
	var objHead = document.getElementsByTagName("head");
	var objScript = document.createElement("script");
	objScript.type = "text/javascript";
	objScript.src = PJS.BASE_URL+sFileName;
	objHead[0].appendChild(objScript);
};
PJS.loads = function(ss){
	ss.each(function(){});
};
PJS.addScript = function(sFileName,trigger){
	var objHead = document.getElementsByTagName("head");
	var objScript = document.createElement("script");
	objScript.type = "text/javascript";
	objScript.src = PJS.BASE_URL+sFileName;
	if(trigger){
		if(PJS.IS_IE){
			objScript.onreadystatechange = function(){
				if(objScript.readyState == "loaded" || objScript.readyState == "complete"){
					if(typeof(trigger) == "function"){
						trigger();
					} else {
						eval(trigger);
					}
				}
			};
		} else {
			objScript.onload = function(){
				if(typeof(trigger) == "function"){
					trigger();
				} else {
					eval(trigger);
				}
			};
		}
	}
	objHead[0].appendChild(objScript);
};
PJS.addScriptAlone = function(sFileName,trigger){
	var sexist = false;
	var a = document.getElementsByTagName("script");
	for(var i=0; i<a.length; i++){
		if(a[i].src == sFileName){
			sexist = true;
		}
	}
	if(sexist == false){
		PJS.addScript(sFileName,trigger);
	}
};
PJS.addStyle = function(sFileName){
	var objHead = document.getElementsByTagName("head");
	var objLink = document.createElement("link");
	objLink.rel = "stylesheet";
	objLink.type = "text/css";
	objLink.href = PJS.BASE_URL+sFileName;
	objHead[0].appendChild(objLink);
};
PJS.createStyle = function(sFileName){
	var objLink = document.createElement("link");
	objLink.rel = "stylesheet";
	objLink.type = "text/css";
	objLink.href = PJS.BASE_URL+sFileName;
	return objLink;
};
PJS.removeStyle = function(sFileName){
	var a = document.getElementsByTagName("link");
	for(var i=0; i<a.length; i++){
		if(a[i].getAttribute("href").indexOf(sFileName) > -1 || a[i].getAttribute("href") == sFileName){
			a[i].parentNode.removeChild(a[i]);
		}
	}
};
PJS.replaceStyle = function(sFileName){
	var a = document.getElementsByTagName("link");
	for(var i=0; i<a.length; i++){
		if(a[i].getAttribute("href").indexOf(sFileName) > -1 || a[i].getAttribute("href") == sFileName){
			a[i].parentNode.replaceChild(PJS.createStyle(sFileName),a[i]);
		}
	}
};
PJS.fixEvent = function(evt){
	var evtx = (typeof evt == "undefined") ? window.event : evt;
	return evtx;
};
PJS.srcElement = function(evt){
	if(typeof evt == "undefined" ) evt = window.event;
	var src = document.all ? evt.srcElement : evt.target;
	return src;
};
PJS.stopEvent = function(evt){
	if(PJS.IS_IE){
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	} else {
		evt.preventDefault();
		evt.stopPropagation();
	}
};
PJS.attachEvent = function(obj,xEvent,handler){
	if(PJS.IS_IE){
		obj.attachEvent("on"+xEvent,handler);
	} else {
		obj.addEventListener(xEvent,handler,false);
	}
	if(xEvent == "click") obj.style.cursor = "pointer";
};
PJS.detachEvent = function(obj,xEvent,handler){
	if(obj.removeEventListener){
		obj.removeEventListener(xEvent,handler,false);
	} else if(obj.detachEvent){
		try {
			obj.detachEvent("on"+xEvent,handler);
		} catch(e){}
	}
};
PJS.addEvent = function(obj,xEvent,handler){
	if(obj.addEventListener){
		obj.addEventListener(xEvent,handler,false);
	} else if(obj.attachEvent){
		obj.attachEvent("on"+xEvent,handler);
	} else {
		el["on"+xEvent] = handler;
	}
};
PJS.removeEvent = function(obj,xEvent,handler){
	if(obj.removeEventListener){
		obj.removeEventListener(xEvent,handler,false);
	} else if(obj.detachEvent){
		try {
			obj.detachEvent("on"+xEvent,handler);
		} catch(e){}
	}
};
PJS.isChild = function(p,d,s){
	if(!d){
		d = PJS.srcElement();
	}
	var el = d;
	while((el = el.parentNode) != null){
		if(el.tagName.toLowerCase() == "body"){
			return false;
		}
		if(el == p){
			return true;
		} else if(!s && el == s){
			return false;
		}
	}
	return false;
};
PJS.getParent = function(d,s){
	if(!d ) return null;
	var el = d;
	while((el = el.parentNode) != null){
		if(el.tagName.toLowerCase() == "body"){
			return null;
		}
		if(typeof(s) == "string" && el.tagName.toLowerCase() == s.toLowerCase()){
			return el;
		} else if(s && el == s){
			return el;
		}
	}
	return null;
};
PJS.getElements = function(p,t,f){
	if(!$E(p)){
		return;
	}
	var a = $E(p).getElementsByTagName(t);
	var b = [];
	for(var i=0; i<a.length; i++){
		if(f==""){
			b.push(a[i]);
		} else if(a[i].name && a[i].name.indexOf(f) > -1){
			b.push(a[i]);
		} else if(a[i].className && a[i].className.indexOf(f) > -1){
			b.push(a[i]);
		} else if(a[i].id && a[i].id.indexOf(f) > -1){
			b.push(a[i]);
		}
	}
	return b;
};
PJS.getElementsC = function(p,c,f){
	if(!$E(p)){
		return;
	}
	var a = $E(p).getElementsByClassName(c);
	var b = [];
	for(var i=0; i<a.length; i++){
		if(f==""){
			b.push(a[i]);
		} else if(a[i].name && a[i].name.indexOf(f) > -1){
			b.push(a[i]);
		} else if(a[i].className && a[i].className.indexOf(f) > -1){
			b.push(a[i]);
		} else if(a[i].id && a[i].id.indexOf(f) > -1){
			b.push(a[i]);
		}
	}
	return b;
};
PJS.getElementsD = function(t,f){
	return PJS.getElements(document,t,f);
};
PJS.createElement = function(parent,tag,id){
	if(typeof(parent) == "string"){
		parent = $E(parent);
	}
	var elem = document.createElement(tag);
	elem.setAttribute("id",id);
	if(parent){
		parent.appendChild(elem);
	}
	return elem;
};
PJS.appendElement = function(parent,tag,id){
	if(typeof(parent) == "string"){
		parent = $E(parent);
	}
	var elem = document.createElement(tag);
	elem.setAttribute("id",id);
	if(parent){
		parent.appendChild(elem);
	}
	return elem;
};
PJS.insertElement = function(before,tag,id){
	if(typeof(before) == "string"){
		before = $E(before);
	}
	var elem = document.createElement(tag);
	elem.setAttribute("id",id);
	before.parentNode.insertBefore(elem,before);//objSibling
	return elem;
};
PJS.insertElementAfter = function(after,tag,id){
	if(typeof(after) == "string"){
		after = $E(after);
	}
	var elem = document.createElement(tag);
	elem.setAttribute("id",id);
	after.parentNode.insertBefore(elem,after.nextSibling);//objSibling.nextSibling
	return elem;
};
PJS.insertAfter = function(after,tag,id){
	PJS.insertElementAfter(after,tag,id);
};
PJS.createInput = function(type,name,id){
	var elem;
	if(PJS.IS_IE && !window.addEventListener){
		if(isUndefined(id)){
			elem = document.createElement('<input type="'+type+'" name="'+name+'">');
		} else {
			elem = document.createElement('<input type="'+type+'" id="'+id+'" name="'+name+'">');
		}
	} else {
		elem = document.createElement("INPUT");
		elem.setAttribute("type",type);
		elem.setAttribute("name",name);
		if(isUndefined(id) == false){
			elem.setAttribute("id",id);
		}
	}
	return elem;
};
PJS.appendInput = function(parent,type,name,id){
	if(typeof(parent) == "string"){
		parent = $E(parent);
	}
	var elem = PJS.createInput(type,name,id);
	if(parent && elem){
		parent.appendChild(elem);
	}
	return elem;
};
PJS.insertInput = function(sibling,type,name,id){
	if(typeof(sibling) == "string"){
		sibling = $E(sibling);
	}
	var elem = PJS.createInput(type,name,id);
	if(elem && sibling && sibling.parentNode){
		sibling.parentNode.insertBefore(elem,sibling);//objSibling
	}
	return elem;
};
PJS.insertInputBefore = function(before,type,name,id){
	if(typeof(before) == "string"){
		before = $E(before);
	}
	var elem = PJS.createInput(type,name,id);
	if(elem && before && before.parentNode){
		before.parentNode.insertBefore(elem,before);//objSibling
	}
	return elem;
};
PJS.insertInputAfter = function(after,type,name,id){
	if(typeof(after) == "string"){
		after = $E(after);
	}
	var elem = PJS.createInput(type,name,id);
	if(elem && after && after.parentNode){
		after.parentNode.insertBefore(elem,after.nextSibling);//objSibling.nextSibling
	}
	return elem;
};
PJS.appendDIV = function(pObj,divId,className,innerHTML){
	var divObj = document.createElement("DIV");
	if(className) divObj.className = className;
	//divObj.appendChild(document.createTextNode(text));
	if(PJS.IS_IE){
		divObj.id = divId;
	} else {
		divObj.setAttribute("id",divId);
	}
	with(divObj.style){
		//display = "none";
		position = "absolute";
	}
	divObj.innerHTML = innerHTML;
	pObj.appendChild(divObj);
	return divObj;
};
PJS.appendDIVHTML = function(divId,innerHTML,className){
	var divObj = document.createElement("DIV");
	
	if(PJS.IS_IE){
		divObj.id = divId;
	} else {
		divObj.setAttribute("id",divId);
	}
	if(className) divObj.className = className;
	with(divObj.style){
		display = "none";
		position = "absolute";
	}
	divObj.innerHTML = innerHTML;
	document.body.appendChild(divObj);
	return divObj;
};
PJS.show = function(el){
	if($E(el)){
		$E(el).style.display = "";
	}
};
PJS.showD = function(el,time){
	if(!time ) time = 200;
	setTimeout("PJS.show("+el+")",time);
};
PJS.showE = function(el){
	if(el && el.style ) el.style.display = "block";
};
PJS.showED = function(el,time){
	if(!time ) time = 200;
	setTimeout(function(){PJS.showE(el);},time);
};
PJS.shows = function(){
	for(var i=0; i<arguments.length; i++){
		if($E(arguments[i])) $E(arguments[i]).style.display = "";
	}
};
PJS.hide = function(el){
	if($E(el)){
		$E(el).style.display = "none";
	}
};
PJS.hideD = function(el,time){
	if(!time ) time = 200;
	setTimeout("PJS.hide("+el+")",time);
};
PJS.hideE = function(el){
	if(el && el.style ) el.style.display = "none";
};
PJS.hideED = function(el,time){
	if(!time ) time = 200;
	setTimeout(function(){PJS.hideE(el);},time);
};
PJS.hides = function(){
	for(var i=0; i<arguments.length; i++){
		if($E(arguments[i])) $E(arguments[i]).style.display = "none";
	}
};
PJS.shChb = function(el,chb){
	if(chb.checked == true){
		$E(el).style.display = "";
	} else {
		$E(el).style.display = "none";
	}
};
PJS.isEditable = function(el){
	if(el.getAttribute("editable")){
		return true;
	}
	return false;
};
PJS.find = function(el,what){
	el = $E(el)[what];
	while(el.nodeType != 1){
		el = el[what];
	}
	return el;
};
PJS.hasAttr = function(el,k){
	if(el.getAttribute(k)){
		return true;
	}
	return false;
};
PJS.getAttr = function(el,k,s){
	if(el && el.getAttribute && el.getAttribute(k)){
		var v = el.getAttribute(k);
		if(s && v.indexOf(s) > -1){
			return v.substring(v.indexOf(s)+1);
		}
		return v;
	}
	return -1;
};
PJS.setAttr = function(el,k,v){
	if(el && el.setAttribute){
		el.setAttribute(k,v);
	}
};
PJS.addClass = function(el,className){
	PJS.removeClass(el,className);
	if(el && el.className){
		el.className += " "+className;
	} else if(el){
		el.className = className;
	}
};
PJS.noClass = function(el){
	if(!(el && el.className)){
		return true;
	}
	return false;
};
PJS.hasClass = function(el,className,t){
	if(!(el && el.className)){
		return;
	}
	if(isUndefined(t)){
		t = 0;
	}
	if(el.className == className){
		return true;
	}
	var cls = el.className.split(" ");
	var ar = new Array();
	for(var i = cls.length; i > 0;){
		--i;
		for(var j=0; j<className.length; j++){
			if(cls[i] == className[j] && t == 0){
				return true;
			} else if(cls[i].indexOf(className[j]) > -1 && t == 1){
				return true;
			}
		}
	}
	return false;
};
PJS.hasClasses = function(el){
	if(!(el && el.className) || arguments.length <= 1){
		return false;
	}
	var classNames = new Array();
	for(var i=1; i<arguments.length; i++){
		classNames.push(arguments[i]);
	}
	var cls = el.className.split(" ");
	var ar = new Array();
	for(var i = cls.length; i > 0;){
		if(PJS.inArray(cls[--i],classNames)){
			return true;
		}
	}
	return false;
};
PJS.removeClass = function(el,className){
	if(!(el && el.className)){
		return;
	}
	var cls = el.className.split(" ");
	var ar = new Array();
	for(var i = cls.length; i > 0;){
		if(cls[--i] != className){
			ar[ar.length] = cls[i];
		}
	}
	el.className = ar.join(" ");
};
PJS.setClassName = function(el,className){
	if(el.className == ""){
		el.className = className;
		return;
	}
	if(el.className.indexOf("\""+className+"\"") > -1 || el.className.indexOf("\""+className+"\" ") > -1 || 
		el.className.indexOf(" "+className+"\"") > -1 || el.className.indexOf(" "+className+" ") > -1){
		return;
	} else {
		el.className = el.className+" "+className;
	}
};
PJS.removeClassName = function(el,className){
	el.className = el.className.replace(new RegExp("/"+className+"/","g"),"");
};
PJS.getStyle = function(el,p){
	if(el.style && el.style.p){
		return el.style[p];
	}
};
PJS.setStyle = function(el,p,v){
	if(!el && !el.style) return false;
	if(p == "opacity"){
		if(v == 0 && el.style.visibility != "hidden"){
			el.style.visibility = "hidden";
		} else if(el.style.visibility != "visible"){
			el.style.visibility = "visible";
		}
		if(window.ActiveXObject){
			el.style.filter = "alpha(opacity="+v*100+")";
		}
		el.style.opacity = v;
	} else if(p == "position" || p == "className"){
		el.style[p] = v;
	} else if(p == "width" || p == "height" || p == "left" || p == "top" || p == "right"){
		el.style[p] = v+"px";
	} else {
		el.style[p] = v+"";
	}
};
PJS.write = function(content){
	document.write(content);
};
PJS.toggle = function(el){
	if($E(el)){
		if($E(el).style.display == ""){
			$E(el).style.display = "none";
		} else {
			$E(el).style.display = "";
		}
	}
};
PJS.toggleWithImg = function(el){
	if($E(el)){
		if($E(el).style.display == ""){
			$E(el).style.display = "none";
			if($E(el+"_img")){
				$E(el+"_img").src = PJS.BASE_URL+"images/collapsed_no.gif";
			}
		} else {
			$E(el).style.display = "";
			if($E(el+"_img")){
				$E(el+"_img").src = PJS.BASE_URL+"images/collapsed_yes.gif";
			}
		}
	}
};
PJS.toggleBH = function(el,obj){
	if($E(el) && obj){
		if($E(el).style.display == ""){
			$E(el).style.display = "none";
			obj.className = "toggle_yes";
		} else {
			$E(el).style.display = "";
			obj.className = "toggle_no";
		}
	}
};
PJS.toggleElement = function(el){
	el = $E(el);
	if(el.style.display == "none"){
		el.style.display = "";
	} else {
		el.style.display = "none";
	}
};
PJS.toggleSH = function(){
	if(arguments.length < 1 ) return;
	for(var i=1; i<arguments.length; i++){
		if($E(arguments[i])){
			$E(arguments[i]).style.display = "none";
		}
	}
	$E(arguments[0]).style.display = "";
};
PJS.toggleTab = function(d,n,h,c){
	for(var i=1; i<=n; i++){
		$E(h+"_"+i).className = "tab_d";
		$E(c+"_"+i).style.display = "none";
	}
	$E(h+"_"+d).className = "tab_c";
	$E(c+"_"+d).style.display = "";
};
PJS.toggleD = function(divId,divId2){
    var d = $E(divId);
	d.style.display = "";
	if(typeof(divId2) != "undefined"){
		$E(divId2).style.display = "none";
	}
	new Effect.BlindDown(divId,{duration:0.5});
};
PJS.enableButton = function(el){
	if($E(el)){
		$E(el).disabled = false;
	}
};
PJS.getOffsetLeft = function(el){
	var ol = el.offsetLeft;
	while ((el = el.offsetParent) != null)
		ol += el.offsetLeft;
	return ol;
};
PJS.getOffsetTop = function(el){
	var ot = el.offsetTop;
	while((el = el.offsetParent) != null)
		ot += el.offsetTop;
	return ot;
};
PJS.offsetWidth = function(el){
	return el.offsetWidth;
};
PJS.offsetHeight = function(el){
	return el.offsetHeight;
};
PJS.getScreenWidth = function(){
	var r = 1200;
	if(window.innerWidth){
		// all except Explorer
		r = parseInt(window.innerWidth);
	} else if(document.documentElement && document.documentElement.clientWidth){
		// Explorer 6 Strict Mode
		r = parseInt(document.documentElement.clientWidth);
	} else if(document.body){
		// other Explorers
		r = parseInt(document.body.clientWidth);
	}
	if(isNaN(r)){
		r = 1200;
	}
	return r;
};
PJS.getScreenHeight = function(){
	var height = 800;
	if(window.innerHeight){// all except Explorer
		r = parseInt(window.innerHeight);
	} else if(document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
		r = parseInt(document.documentElement.clientHeight);
	} else if(document.body){// other Explorers
		r = parseInt(document.body.clientHeight);
	}
	if(isNaN(r)){
		r = 800;
	}
	return r;
};
PJS.getScrollTop = function(){
	var r = 0;
	if(document.documentElement && document.documentElement.scrollTop){
		r = parseInt(document.documentElement.scrollTop);
	} else if(document.body){
		r = parseInt(document.body.scrollTop);
	}
	if(isNaN(r)){
		r = 0;
	}
	return r;
};
PJS.getScrollLeft = function(){
	var r = 0;
	if(document.documentElement && document.documentElement.scrollLeft){
		r = parseInt(document.documentElement.scrollLeft);
	} else if(document.body){
		r = parseInt(document.body.scrollLeft);
	}
	if(isNaN(r)){
		r = 0;
	}
	return r;
};
PJS.getX = 0;
PJS.getY = 0;
PJS.getPosition = function(){
	var position = new Array();
	var evt = null;
	if(PJS.IS_IE){
		evt = window.event;
	} else {
		//evt = arguments[0];
		try {
			window.constructor.prototype.__defineGetter__("event",window_prototype_get_event);
		} catch(e){}
		evt = window.event;
	}
	if(evt == null || typeof(evt) == "undefined"){
		PJS.getX = 300;
		PJS.getY = 200;
		position[0] = PJS.getX;
		position[1] = PJS.getY;
		return position;
	}
	if(evt.pageX || evt.pageY){
		PJS.getX = evt.pageX;
		PJS.getY = evt.pageY;
	} else {
		if(evt.clientX || evt.clientY){
			if(document.body.scrollLeft > document.documentElement.scrollLeft){
				PJS.getX = evt.clientX+document.body.scrollLeft;
			} else {
				PJS.getX = evt.clientX+document.documentElement.scrollLeft;
			}
			
			if(document.body.scrollTop > document.documentElement.scrollTop){
				PJS.getY = evt.clientY+document.body.scrollTop;
			} else {
				PJS.getY = evt.clientY+document.documentElement.scrollTop;
			}
		}
	}
	position[0] = PJS.getX;
	position[1] = PJS.getY;
	return position;
};
PJS.windowWidth = 800;
PJS.windowHeight = 600;
PJS.getWindowSize = function(){
	if(window.innerHeight){// all except Explorer
		PJS.windowWidth = window.innerWidth;
		PJS.windowHeight = window.innerHeight;
	} else if(document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
		PJS.windowWidth = document.documentElement.clientWidth;
		PJS.windowHeight = document.documentElement.clientHeight;
	} else if(document.body){// other Explorers
		PJS.windowWidth = document.body.clientWidth;
		PJS.windowHeight = document.body.clientHeight;
	}
};
PJS.pageWidth = 800;
PJS.pageHeight = 600;
PJS.getPageSize = function(){
	var windowWidth,windowHeight;
	if(window.innerHeight){// all except Explorer
		windowWidth = window.innerWidth;
		windowHeight = window.innerHeight;
	} else if(document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if(document.body){// other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	var xScroll,yScroll;
	if(window.innerHeight && window.scrollMaxY){
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight+window.scrollMaxY;
	} else if(document.body.scrollHeight > document.body.offsetHeight){// all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {// Explorer Mac...would also work in Explorer 6 Strict,Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll<windowWidth){
		PJS.pageWidth = xScroll;
	} else {
		PJS.pageWidth = windowWidth;
	}
	// for small pages with total height less then height of the viewport
	if(yScroll<windowHeight){
		PJS.pageHeight = windowHeight;
	} else { 
		PJS.pageHeight = yScroll;
	}
};
PJS.getCursorPosition = function(){
	var obj = document.activeElement;
	var cur = document.selection.createRange();
	var pos = 0;
	if(obj && cur){
		var tr = obj.createTextRange();
		if(tr){
			while(cur.compareEndPoints("StartToStart",tr) > 0){
				tr.moveStart("character",1);
				pos++;
			}
			return pos;
		}
	}
	return -1;
};
PJS.Mask = function(divId,width,height,percent,text){
	if(typeof(percent) == "undefined") percent = 50;
	if(typeof(text) == "undefined") text = "";
	var element = $E(divId);
	if(element && element.innerHTML == ""){
		return;
	} else {
		element = document.body;
	}
	PJS.getPageSize();
	var pw = PJS.pageWidth;
	var ph = PJS.pageHeight;//+PJS.getScrollTop();
	var left = Math.ceil((pw - width)/2);
	var top = Math.ceil((ph - height)/2);
	var divObjInnerHTML = text;
	var objBrother = element.childNodes[0];
	var divObj = document.createElement("DIV");
	divObj.setAttribute("id","div_mask");
	divObj.style.textAlign = "center";
	divObj.style.position = "absolute";
	divObj.style.left = left+"px";
	divObj.style.top = top+"px";
	divObj.style.width = width+"px";
	divObj.style.height = height+"px";
	divObj.style.margin = "0px";
	divObj.style.opacity = (percent / 100);
	divObj.style.MozOpacity = (percent / 100);
	divObj.style.KhtmlOpacity = (percent / 100);
	divObj.style.filter = "alpha(opacity="+percent+")";
	divObj.style.backgroundColor = "#CACACA";
	
	element.insertBefore(divObj,objBrother);
	divObj.innerHTML = divObjInnerHTML;
};
PJS.MaskB = function(percent){
	if(typeof(percent) == "undefined") percent = 50;
	if(typeof(text) == "undefined") text = "";
	PJS.getPageSize();
	var width = PJS.pageWidth;
	var height = PJS.pageHeight;//+PJS.getScrollTop();
	var left = 0;
	var top = 0;
	var divObjInnerHTML = "<div></div>";
	var element = document.body;
	var objBrother = element.childNodes[0];
	var divObj = document.createElement("DIV");
	divObj.setAttribute("id","body_mask");
	divObj.style.textAlign = "center";
	divObj.style.position = "absolute";
	divObj.style.left = left+"px";
	divObj.style.top = top+"px";
	divObj.style.width = width+"px";
	divObj.style.height = height+"px";
	divObj.style.margin = "0px";
	divObj.style.opacity = (percent / 100);
	divObj.style.MozOpacity = (percent / 100);
	divObj.style.KhtmlOpacity = (percent / 100);
	divObj.style.filter = "alpha(opacity="+percent+")";
	divObj.style.backgroundColor = "#000000";
	
	element.insertBefore(divObj,objBrother);
};
PJS.MaskT = function(text){
	PJS.MaskB(5);
	PJS.Mask("processing",500,200,60,text);
};
PJS.MaskD = function(){
	PJS.removeE($E("body_mask"));
};
PJS.removeD = function(id){
	PJS.removeE($E(id));
};
PJS.removeE = function(el){
	if(el && el.parentNode && el.parentNode.removeChild){
		el.parentNode.removeChild(el);
	}
};
PJS.cssJsMenu_status = 0;
PJS.cssJsMenu = function(e){
	if($E(e)){
		var root = $E(e);
		var a = root.getElementsByTagName("LI");
		
		for(var i=0; i<a.length; i++){
			a[i].onmouseover = function(){
				for(var j=0; j<this.getElementsByTagName("UL").length; j++){
					//this.getElementsByTagName("UL")[j].style.display = "block";
					PJS.showE(this.getElementsByTagName("UL")[j]);
				}
			};
			a[i].onmouseout = function(){
				for(var j=0; j<this.getElementsByTagName("UL").length; j++){
					//this.getElementsByTagName("UL")[j].style.display = "none";
					PJS.hideE(this.getElementsByTagName("UL")[j]);
				}
			};
		}
	}
};
PJS.cssJsMenuA = function(e){
	if($E(e)){
		var root = $E(e);
		var a = root.getElementsByTagName("LI");
		
		for(var i=0; i<a.length; i++){
			for(var j=0; j<a[i].getElementsByTagName("UL").length; j++){
				a[i].onmouseover = function(){
					this.getElementsByTagName("UL")[j].style.display = "";
					//this.getElementsByTagName("UL")[j].style.backgroundColor = '#666666';
					this.getElementsByTagName("UL")[j].parentNode.className = "cc";
					this.getElementsByTagName("UL")[j].style.width = "200px";
					this.getElementsByTagName("UL")[j].style.position = "absolute";
					//this.getElementsByTagName("UL")[j].style.left = (PJS.getOffsetLeft(root)+root.offsetWidth - 20)+"px";
					//this.getElementsByTagName("UL")[j].style.top = PJS.getOffsetTop(this)+"px";
					//this.getElementsByTagName("UL")[j].style.top = (-10)+"px";
				};
				a[i].onmouseout = function(){
					this.getElementsByTagName("UL")[j].style.display = "none";
					this.getElementsByTagName("UL")[j].parentNode.className = "cd";
				};
			}
		}
	}
};
PJS.cssJsMenuB = function(e){
	if($E(e)){
		var root = $E(e);
		var a = root.getElementsByTagName("LI");
		
		for(var i=0; i<a.length; i++){
			a[i].onmouseover = function(){
				for(var j=0; j<this.getElementsByTagName("UL").length; j++){
					this.getElementsByTagName("UL")[j].style.visibility = "visible";
				}
			};
			a[i].onmouseout = function(){
				for(var j=0; j<this.getElementsByTagName("UL").length; j++){
					this.getElementsByTagName("UL")[j].style.visibility = "hidden";
				}
			};
		}
	}
};
PJS.cssJsMenuC = function(e){
	if($E(e)){
		var root = $E(e);
		var a = root.getElementsByTagName("LI");
		
		for(var i=0; i<a.length; i++){
			if(a[i].getAttribute("pc") != null && a[i].getAttribute("pc").indexOf(":") == -1){
				a[i].onclick = function(){
					var pc = this.getAttribute("pc");
					if(pc != null){
						if(pc.indexOf(":") > -1){
							pc = pc.substring(pc.indexOf(":")+1);
						}
						PJS.removeClass(this,"cd");
						PJS.addClass(this,"cc");
						for(var j=0; j<a.length; j++){
							if(a[j].getAttribute("pc") != null && a[j].getAttribute("pc").indexOf(":") > -1){
								if(a[j].getAttribute("pc").indexOf(pc+":") > -1){
									if(a[j].style.display == ""){
										PJS.removeClass(this,"hsa");
										PJS.addClass(this,"hsb");
										a[j].style.display = "none";
									} else {
										a[j].style.display = "";
										PJS.removeClass(this,"hsb");
										PJS.addClass(this,"hsa");
									}
								} else {
									//a[j].style.display = "none";
								}
							}
						}
					}
				};
				a[i].onmouseover = function(){
					PJS.addClass(this,"over");
				};
				a[i].onmouseout = function(){
					PJS.removeClass(this,"over");
				};
			}
		}
	}
};
PJS.previewImage = function(obj,target){
	if(!obj.value || !PJS.checkImageType(obj.value)){
		return false;
	}
	if(!PJS.IS_IE){
		return false;
	}
	var image = new Image();
	image.src = obj.value.replace(/\\/g,"/");
	image.width = 200;
	image.height = 200;
	if($E(target)){
		$E(target).innerHTML = '<img src="'+image.src+'" width="'+image.width+'" height="'+image.height+'">';
	}
};
PJS.checkcodeImage = function(el){
	var src = $E(el).src;
	if(src.indexOf("?r=") == -1){
		src += "?r="+PJS.rand();
	} else {
		src = src.substring(0,src.indexOf("?r="))+"?r="+PJS.rand();
	}
	$E(el).src = src;
};
PJS.checkImageType = function(filename){
	var patten = /\.jpg$|\.jpeg$|\.gif$|\.png$|\.bmp$/i;
	
	if(filename.match(patten) == null){
		return false;
	} else {
		return true;
	}
	/*
	if(filename.search(patten) != -1){
		return true;
	} else {
		return false;
	}
	*/
	var image_types = new Array(".gif",".jpg",".jpeg",".png",".bmp");
	var image_types_lenght = image_types.lenght;
	var image_url;
	var image_url_length;
	for(var i=0; i<image_types_lenght; i++){
		image_url = filename.toLowerCase();
		image_url_length = image_url.length;
		if(image_url.substring(image_url_length - image_types[i].length,image_url_length) == image_types[i]){
			return true;
		}
	}
	
	return false;
};
/////////////////////////////////////////////////////////////////////////////
//PJS.action
PJS.action = function(){};
PJS.action.count = 0;
PJS.action.timer = [];
PJS.action.delay = function(handler,timeout){
	var c = PJS.action.count;
	var timer = window.setTimeout(function(){
				handler();
				if(PJS.action.timer[c]){
					window.clearTimeout(PJS.action.timer[c]);
					PJS.action.timer[c] = null;
				}
			},timeout);
	PJS.action.timer.push(timer);
	PJS.action.count++;
};
PJS.action.repeat = function(handler,timeout){
	var timer = window.setInterval(handler,timeout);
	PJS.action.timer.push(timer);
	PJS.action.count++;
};
PJS.action.delay_show = function(el,timeout){
	var handler = function(){
		PJS.show($E(el));
	};
	PJS.action.delay(handler,timeout);
};
PJS.action.delay_hide = function(el,timeout){
	var handler = function(){
		PJS.hide($E(el));
	};
	PJS.action.delay(handler,timeout);
};
PJS.action.delay_clean = function(el,timeout){
	var handler = function(){
		$E(el).innerHTML = "";
	};
	PJS.action.delay(handler,timeout);
};
/////////////////////////////////////////////////////////////////////////////
//PJS.list
PJS.list = function(){};
PJS.list.show =  function(type,length){
	if(!length){
		length = 10;
	}
	if($E("list_"+type+"_h")){
		$E("list_"+type+"_h").style.display = "";
	}
	for(var i=0; i<length; i++){
		if($E("list_"+type+"_"+i)){
			$E("list_"+type+"_"+i).style.display = "";
		}
	}
};
PJS.list.hide =  function(type,length){
	if(!length){
		length = 10;
	}
	if($E("list_"+type+"_h")){
		$E("list_"+type+"_h").style.display = "none";
	}
	for(var i=0; i<length; i++){
		if($E("list_"+type+"_"+i)){
			$E("list_"+type+"_"+i).style.display = "none";
		}
	}
};
PJS.list.toggle =  function(type,length){
	if(!length){
		length = 30;
	}
	if($E("list_"+type+"_h")){
		if($E("list_"+type+"_h").style.display == ""){
			$E("list_"+type+"_h").style.display = "none";
		} else {
			$E("list_"+type+"_h").style.display = "";
		}
	}
	for(var i=0; i<length; i++){
		if($E("list_"+type+"_"+i)){
			if($E("list_"+type+"_"+i).style.display == ""){
				$E("list_"+type+"_"+i).style.display = "none";
			} else {
				$E("list_"+type+"_"+i).style.display = "";
			}
		}
	}
};
PJS.list.gc = function(obj){
	while(obj.nodeName != "TABLE"){
		obj = obj.parentNode;
	}
	return obj;
};
PJS.list.selectAll = function(obj,chk){
	if(chk == null){
		chk = "cb";
	}
	var c = null;
	if(obj.form){
		c = obj.form;
	} else if(obj.parentNode.parentNode.nodeType){
		c = PJS.list.gc(obj);
	}
	var a = c.getElementsByTagName("INPUT");
	for(var i=0; i<a.length; i++){
		if(a[i].name == chk || a[i].name == chk+"[]"){
			a[i].checked = obj.checked;
		}
	}
};
PJS.list.hasSelected = function(obj,chk){
	if(chk == null){
		chk = "cb";
	}
	var c = null;
	if(obj.form){
		c = obj.form;
	} else if(obj.parentNode.parentNode.nodeType){
		c = PJS.list.gc(obj);
	}
	var a = c.getElementsByTagName("INPUT");
	for(var i=0; i<a.length; i++){
		if(a[i].name == chk || a[i].name == chk+"[]"){
			if(a[i].checked){
				return true;
			}
		}
	}
	return false;
};
PJS.list.getSelected = function(obj,chk){
	if(chk == null){
		chk = "cb";
	}
	var ss = [];
	var c = null;
	if(obj.form){
		c = obj.form;
	} else if(obj.parentNode.parentNode.nodeType){
		c = PJS.list.gc(obj);
	}
	var a = c.getElementsByTagName("INPUT");
	for(var i=0; i<a.length; i++){
		if(a[i].name == chk || a[i].name == chk+"[]"){
			if(a[i].checked){
				ss.push(a[i].value);
			}
		}
	}
	return ss;
};
PJS.list.getItems = function(obj,name){
	if(name == null){
		name = "cb";
	}
	var ss = [];
	var c = null;
	if(obj.form){
		c = obj.form;
	} else if(obj.parentNode.parentNode.nodeType){
		c = PJS.list.gc(obj);
	}
	var a = c.getElementsByTagName("INPUT");
	for(var i=0; i<a.length; i++){
		if(a[i].name == name || a[i].name == name+"[]"){
			ss.push(a[i]);
		}
	}
	return ss;
};
PJS.list.getValues = function(obj,name){
	if(name == null){
		name = "cb";
	}
	var ss = [];
	var c = null;
	if(obj.form){
		c = obj.form;
	} else if(obj.parentNode.parentNode.nodeType){
		c = PJS.list.gc(obj);
	}
	var a = c.getElementsByTagName("INPUT");
	for(var i=0; i<a.length; i++){
		if(a[i].name == name || a[i].name == name+"[]"){
			ss.push(a[i].value);
		}
	}
	return ss;
};
PJS.list.getValuesTotal = function(obj,name){
	var total = 0;
	var ss = PJS.list.getValues(obj,name);
	for(var i=0; i<ss.length; i++){
		total += parseFloat(ss[i]);
	}
	return total;
};
PJS.list.doActionCheck = function(action,obj,handler,chk){
	if(chk == null || chk == ""){
		chk = "cb";
	}
	var _action = "";
	if(obj.form.action){
		_action = obj.form.action.value;
	} else {
		//var t = document.createElement("INPUT");
		//t.setAttribute("type","hidden");
		//t.setAttribute("name","action");
		//obj.form.appendChild(t);
		var t = PJS.createInput("hidden","action");
		if(!t ) return;
		obj.form.appendChild(t);
	}
	obj.form.action.value = action;
	var a = obj.form.getElementsByTagName("INPUT");
	var ab = 0;
	var ac = false;
	var ad = [];
	for(var i=0; i<a.length; i++){
		if(a[i].name == chk || a[i].name == chk+"[]"){
			if(a[i].checked){
				ac = true;
				ad.push(a[i].value);
			}
			ab++;
		}
	}
	if(ab > 0 && ac == false){
		obj.form.action.value = _action;
		if(obj.tagName.toUpperCase()=="SELECT"){
			if(obj.options.length > 0) {
				if(obj.options[0].value == "" || obj.options[0].value == "0"){
					obj.options[0].selected = true;
				} else {
					obj.options[0].selected = true;
				}
			} else {
				obj.value = "";
			}
		}
		alert("Please select the items");
		return false;
	}
	if(confirm("Are you sure you want to do the operation?") == true){
		if(handler && typeof(handler) == "function"){
			handler(obj.form,ad);
		} else if(handler && typeof(handler) == "string"){
			handler(obj.form,ad);
		} else if(handler && handler.length > 1 && typeof(handler[0]) == "function" && typeof(handler[1]) == "object"){
			handler[0].call(handler[1],obj.form,ad);
		} else {
			obj.form.submit();
		}
		return true;
	} else {
		obj.form.action.value = _action;
		if(obj.tagName.toUpperCase()=="SELECT"){
			if(obj.options.length > 0) {
				if(obj.options[0].value == "" || obj.options[0].value == "0"){
					obj.options[0].selected = true;
				} else {
					obj.options[0].selected = true;
				}
			} else {
				obj.value = "";
			}
		}
	}
	return false;
};
PJS.list.doActionField = function(action,obj){
	if(obj.value==""){
		alert("select operation");
		return false;
	}
	PJS.list.doActionCheck(action,obj);
};
PJS.list.doActionFieldA = function(action,obj,value){
	obj.value = value;
	PJS.list.doActionCheck(action,obj);
};
PJS.list.doAction = function(action,obj,post){
	if(obj.form){
		if(obj.form.action){
			//
		} else {
			//var t = document.createElement("INPUT");
			//t.setAttribute("type","hidden");
			//t.setAttribute("name","action");
			//obj.form.appendChild(t);
			var t = PJS.createInput("hidden","action");
			if(!t ) return;
			obj.form.appendChild(t);
		}
		if(post){
			obj.form.setAttribute("action",post);
		}
		obj.form.action.value = action;
		obj.form.submit();
	}
};
PJS.list.doDelete = function(action,id,msg){
	var form = PJS.getParent(obj,"FORM");
	var chk = false;
	var row = null;
	var cb = form.elements["cb[]"];
	if(isUndefined(cb.length)){
		if(cb.value == id){
			chk = true;
			row = PJS.getParent(cb,"TR");
		}
	} else {
		for(var i=0; i<cb.length; i++){
			if(cb[i].value == id){
				chk = true;
				row = PJS.getParent(cb[i],"TR");
			}
		}
	}
	if(chk && row && PJS.list.delchk(msg)){
		var params = {"action": action,"id": id};
		xh_d("",params,function(r){
				if(r == "success"){
					PJS.removeE(row);
				} else {
					alert("Error");
				}
				});
	}
};
PJS.list.del = function(action,id,msg){
	if(!msg ) msg = "Delete?";
	if(confirm(msg)){
		return true;
	}
	
	return false;
};
PJS.list.delchk = function(msg){
	if(!msg ) msg = "Delete?";
	if(confirm(msg)){
		return true;
	}
	
	return false;
};
PJS.list.delchkgo = function(url,msg){
	if(!msg ) msg = "Delete?";
	if(confirm(msg)){
		PJS.redirect(url);
	}
	
	return false;
};
/////////////////////////////////////////////////////////////////////////////
//PJS.select
PJS.navigation = function(){};
PJS.navigation.change = function(obj){
	var name = obj.name;
	var value = obj.value;
	var url = document.URL;
	var urlp = 0;
	var urlpd = 0;
	if((urlp = url.indexOf("?"+name+"=")) > -1){
		urlpd = url.indexOf("&",urlp+1);
		if(urlpd > -1){
			url = url.substring(0,urlp)+"?"+name+"="+value+url.substring(urlpd);
		} else {
			url = url.substring(0,urlp)+"?"+name+"="+value;
		}
	} else if((urlp = url.indexOf("&"+name+"=")) > -1){
		urlpd = url.indexOf("&",urlp+1);
		if(urlpd > -1){
			url = url.substring(0,urlp)+"&"+name+"="+value+url.substring(urlpd);
		} else {
			url = url.substring(0,urlp)+"&"+name+"="+value;
		}
	} else {
		if(url.indexOf("?") > -1){
			url += "&";
		} else {
			url += "?";
		}
		url += name+"="+value;
	}
	document.location.href = url;
};
PJS.navigation.goto = function(name,value){
	
};
/////////////////////////////////////////////////////////////////////////////
//PJS.select
PJS.select = function(target,text,id){
	if($E(target)){
		$E(target).value = text;
	}
};
PJS.select4 = function(a,b,c,d){
	if($E(a)){
		$E(a).value = b;
	}
	if($E(c)){
		$E(c).value = d;
	}
};
PJS.selectlt = function(a,b,c,d){
	if(!d ) d = 0;
	for(var i=d; i<c; i++){
		if($E(b+i)){
			$E(b+i).style.display = "none";
		}
	}
	if($E(b+a.value)){
		$E(b+a.value).style.display = "";
	}
};
/////////////////////////////////////////////////////////////////////////////
//PJS.selection
PJS.selection = function(){};
PJS.selection.select = function(obj,prefix){//select
	var v;
	var l = obj.options.length;
	if(l > 0){
		for(var i=0; i<l; i++){
			v = obj.options[i].value;
			if($E(prefix+"_"+v)){
				$E(prefix+"_"+v).style.display = "none";
			}
		}
	}
	v = obj.value;
	if($E(prefix+"_"+v)){
		$E(prefix+"_"+v).style.display = "";
	}
};
PJS.selection.getvalue = function(obj){//option
	var v = "";
	var l = obj.options.length;
	for(var i=0; i<l; i++){
		if(obj.options[i].selected){
			if(v == ""){
				v += obj.options[i].value;
			} else {
				v += ","+obj.options[i].value;
			}
		}
	}
	return v;
};
PJS.selection.selectg = function(obj,prefix){//radio
	var v;
	var l = obj.form.elements.length;
	if(l > 0){
		for(var i=0; i<l; i++){
			v = obj.form.elements[i].value;
			if(obj.form.elements[i].name == obj.name && $E(prefix+"_"+v)){
				$E(prefix+"_"+v).style.display = "none";
			}
		}
	}
	v = obj.value;
	if($E(prefix+"_"+v)){
		$E(prefix+"_"+v).style.display = "";
	}
};
PJS.selection.getval = function(name,form){//radio
	for(var i=0; i<form.elements.length; i++){
		if(form.elements[i].name == name && form.elements[i].checked){
			return form.elements[i].value;
		}
	}
	
	return null;
};
PJS.selection.selectc = function(v,el,p,t){//common
	if(!t ) tag = "LI";
	if(!p ) p = "item";
	var a = PJS.getElements(el,t,p);
	for(var i=0; i<a.length; i++){
		a[i].style.display = "none";
	}
	if($E(p+"_"+v)){
		$E(p+"_"+v).style.display = "";
	}
};
PJS.selection.createselect = function(name,target,handler){
	var cs = document.createElement("SELECT");
	//cs.setAttribute("id","categories");
	cs.setAttribute("name",name);
	cs.setAttribute("className","");
	if(isUndefined(handler) == false){
		PJS.attachEvent(cs,"change",handler);
	}
	if(isUndefined(target) || target == false){
		return cs;
	}
	target.appendChild(cs);
};
PJS.selection.createoption = function(obj,text,value,selected,check){
	if(isUndefined(selected)) selected = true;
	if(isUndefined(check)) check = false;
	if(check && PJS.selection.has(obj,value)){
		PJS.selection.selected(obj,value);
		return;
	}
	var co = document.createElement("OPTION");
	co.text = text.replace(/&nbsp;/g," ");
	co.value = value;
	if(selected){
		co.selected = true;
	}
	return co;
};
PJS.selection.createselection = function(name,data,selected,target,handler){
	var cs = PJS.selection.createselect(name,false,handler);
	for(var i=0; i<data.length; i++){
		if(data[i][0] == selected){
			PJS.selection.append(cs,data[i][1],data[i][0],true,false);
		} else {
			PJS.selection.append(cs,data[i][1],data[i][0],false,false);
		}
	}
	if(target){
		target.appendChild(cs);
	}
};
PJS.selection.add = function(obj,text,value,check){
	PJS.selection.append(obj,text,value,check);
};
PJS.selection.append = function(obj,text,value,selected,check){
	var co = PJS.selection.createoption(obj,text,value,selected,check);
	obj.options.add(co);
};
PJS.selection.addsep = function(obj,value,label){
	if(isUndefined(value)) value = -1;
	if(isUndefined(label)) label = "-------------------";
	var co = document.createElement("OPTION");
	co.text = label;
	co.value = value;
	co.label = label;
	co.disabled = true;
	obj.insertBefore(co,obj.firstChild);
};
PJS.selection.addfirst = function(obj,text,value,selected,check){
	var co = PJS.selection.createoption(obj,text,value,selected,check);
	obj.insertBefore(co,obj.firstChild);
};
PJS.selection.remove = function(obj,value){
	for(var i=0; i<obj.options.length; i++){
		if(obj.options[i].value == value){
			obj.options[i].parentNode.removeChild(obj.options[i]);
		}
	}
};
PJS.selection.clearselection = function(target){
	if(target){
		target.innerHTML = "";
	}
};
PJS.selection.clearoptions = function(obj){
	obj.options.length = 1;
};
PJS.selection.has = function(obj,value){
	for(var i=0; i<obj.options.length; i++){
		if(obj.options[i].value == value){
			return true;
		}
	}
	return false;
};
PJS.selection.selected = function(obj,value){
	for(var i=0; i<obj.options.length; i++){
		if(obj.options[i].value == value){
			obj.options[i].selected = true;
		}
	}
};
PJS.selection.dinit = function(src,dst){
	PJS.selection.dsrc = $E(src);
	PJS.selection.ddst = $E(dst);
};
PJS.selection.dadd = function(){
	alert(PJS.selection.dsrc.options[PJS.selection.dsrc.selectedIndex]);
};
PJS.selection.ddel = function(){
	
};
/////////////////////////////////////////////////////////////////////////////
//PJS.tip
PJS.tip = function(){};
PJS.tip._inited = false;
PJS.tip._tds = 0;
PJS.tip._timer = null;
PJS.tip.init = function(){
	PJS.tip.init_tipd();
	PJS.tip._inited = true;
};
PJS.tip.init_tipd = function(){
	PJS.tip._td = PJS.appendDIVHTML("tipd","","tipd");
	with(PJS.tip._td.style){
		zIndex = "1000";
		display = "";
		position = "absolute";
		visibility = "hidden";
	}
	PJS.attachEvent(PJS.tip._td,"mouseover",PJS.tip._over);
	PJS.attachEvent(PJS.tip._td,"mouseout",PJS.tip._out);
};
PJS.tip.init_overd = function(){
	PJS.tip.overd = PJS.appendDIVHTML("overd","overd");
	with(PJS.tip.overd.style){
		zIndex = "1000";
		display = "";
		position = "absolute";
		//top = "50px";
		//left = "100px";
		//width = "100px";
		//height = "100px";
		//backgroundColor = "#DADADA";
		//borderWidth = "1";
		//borderColor = "#ADDADA";
		//borderStyle = "solid";
		visibility = "hidden";
	}
};
PJS.tip._up = function(evt){
	if(PJS.tip._tds == 0) return;
	var evt = PJS.fixEvent(evt);
	var tx = PJS.tip._td.offsetLeft;
	var ty = PJS.tip._td.offsetTop;
	var tw = PJS.tip._td.offsetWidth;
	var th = PJS.tip._td.offsetHeight;
	var ex = document.body.scrollLeft+evt.clientX;
	var ey = document.body.scrollTop+evt.clientY;
	if(tx <= ex && tx+tw >= ex && ty <= ey && ty+th >= ey){
		//
	} else {
		PJS.tip._tds = 0;
		PJS.tip._hide();
		PJS.detachEvent(document,"mouseup",PJS.tip._up);
	}
};
PJS.tip._over = function(){
	PJS.tip._tds = 1;
};
PJS.tip._out = function(){
	PJS.tip._tds = 0;
	PJS.tip._timer = window.setTimeout(PJS.tip._hide,500);
};
PJS.tip._hide = function(){
	if(PJS.tip._tds == 1) return false;
	if(PJS.tip._inited == false){
		PJS.tip.init();
	}
	PJS.tip._td.innerHTML = "";
	PJS.tip._td.style.visibility = "hidden";
	PJS.tip._tds = 0;
};
PJS.tip.show = function(c){
	if(PJS.tip._inited == false){
		PJS.tip.init();
	}
	PJS.tip._td.innerHTML = c;
	PJS.tip._td.style.visibility = "";
};
PJS.tip.hide = function(){
	if(PJS.tip._inited == false){
		PJS.tip.init();
	}
	PJS.tip._td.innerHTML = "";
	PJS.tip._td.style.visibility = "hidden";
	PJS.tip._tds = 0;
};
PJS.tip.showE = function(el,c,l,t){
	if(PJS.tip._inited == false){
		PJS.tip.init();
	}
	PJS.tip._td.innerHTML = c;
	PJS.tip._td.style.visibility = "";
	PJS.tip._tds = 1;
	//
	PJS.attachEvent(document,"mouseup",PJS.tip._up);
	//
	if(!l) l = 0;
	if(!t) t = 20;
	//
	PJS.tip._td.style.left = (PJS.getOffsetLeft(el)+l)+"px";
	if(el.scrollHeight > el.offsetHeight){
		PJS.tip._td.style.top = (PJS.getOffsetTop(el)-el.scrollHeight+el.offsetHeight+t)+"px";
	} else {
		PJS.tip._td.style.top = (PJS.getOffsetTop(el)+t)+"px";
	}
};
PJS.tip.hideE = function(){
	if(PJS.tip._inited == false){
		PJS.tip.init();
	}
	if(PJS.tip._tds == 1){
		return false;
	}
	PJS.tip._td.style.visibility = "hidden";
	PJS.tip._tds = 0;
};
PJS.tip.tc = function(cls){
	PJS.addClass(PJS.tip._td,cls);
};
PJS.tip.startlink = function(){
	var links = document.links;
	var total = links.length;
	var alink;
	for(var k=0; k<total; k++){
		alink = links[k];
		if(alink.title){
			alink.onmouseover = function(){
				return overlib(alink.title);
			};
			alink.onmouseout = function(){
				return nd();
			};
		}
	}
};
PJS.tip.startimage = function(){
	var images = document.images;
	var total = images.length;
	var image;
	for(var k=0; k<total; k++){
		image = images[k];
		if(image.alt){
			image.onmouseover = function(){
				return overlib(image.alt);
			};
			image.onmouseout = function(){
				return nd();
			};
		}
	}
};
/////////////////////////////////////////////////////////////////////////////
//PJS.sort
PJS.sortable = function(el,cmp){
	this.target = $E(el);
	this.compare = cmp;
};
PJS.sortable.prototype.getelements = function(){
	var els = [];
	var a = this.target.getElementsByTagName(this.compare);
	for(var i=0; i<a.length; i++){
		els.push(a[i]);
	}
	return els;
};
PJS.sortable.prototype.asc = function(){
	return false;
};
PJS.sortable.prototype.desc = function(){
	return false;
};
/////////////////////////////////////////////////////////////////////////////
//PSJ.dragable
PJS.dragable = function(target,dragger){
	if(target && dragger){
		this.register(target,dragger);
	}
};
PJS.dragable.prototype.uid = 0;
PJS.dragable.prototype.timeout = null;
PJS.dragable.prototype.register = function(target,dragger){
	this.uid = PJS.rand("dragable");
	this.target = target;
	this.dragger = dragger;
	PJS.dragable._add(this);
	PJS.attachEvent(dragger,"mousedown",function(event){var dragger = PJS.dragable._get(this);if(dragger) dragger.start(event);});
};
PJS.dragable.prototype.start = function(evt){
	//PJS.attachEvent(document,"mousedown",this.drag);
	this.drag(evt);
	var dragger = this;
	this.active = true;
	PJS.dragable._start(this);
	PJS.attachEvent(document,"mousemove",function(event){dragger.move(event);});
	PJS.attachEvent(document,"mouseup",function(event){dragger.up(event);});
	if(this.timeout){
		clearTimeout(this.timeout);
	}
};
PJS.dragable.prototype.close = function(){
	if(this.timeout){
		clearTimeout(this.timeout);
	}
	PJS.hideE(this.target);
	this.onEvent("afterclose");
};
PJS.dragable.prototype.drag = function(evt){
	this.moveFlag = true;
	//this.target.style.cursor = "pointer";
	var posX,posY;
	if(PJS.IS_IE){
		posY = window.event.clientY+document.body.scrollTop;
		posX = window.event.clientX+document.body.scrollLeft;
	} else {
		posX = evt.pageX;
		posY = evt.pageY;
	}
	this.curWidth = parseInt(posX - PJS.getOffsetLeft(this.target));
	this.curHeight = parseInt(posY - PJS.getOffsetTop(this.target));
};
PJS.dragable.prototype.dragb = function(ex){
	this.moveFlag = true;
	if(PJS.IS_IE){
		position = PJS.getPosition();
	} else {
		try {
		} catch(e){
		}
		PJS.getX = event.pageX;
		PJS.getY = event.pageY;
	}
	this.curWidth = PJS.getX;
	this.curHeight = PJS.getY;
	//this.target.style.cursor = "pointer";
};
PJS.dragable.prototype.move = function(evt){
	if(this.active == false){
		return;
	}
	var posX,posY;
	if(PJS.IS_IE){
		posY = window.event.clientY+document.body.scrollTop;
		posX = window.event.clientX+document.body.scrollLeft;
	} else {
		posX = evt.pageX;
		posY = evt.pageY;
	}
	if(posX - this.curWidth+PJS.offsetWidth(this.target)<50){
		return;
	}
	if(posY - this.curHeight < 0){
		return;
	}
	
	this.target.style.left = parseInt(posX - this.curWidth)+"px";
	this.target.style.top = parseInt(posY - this.curHeight)+"px";
	this.stopEvent(evt);
};
PJS.dragable.prototype.moveb = function(evt){
	if(this.moveFlag == false){
		return;
	}
	//this.target.style.cursor = "pointer";
	if(PJS.IS_IE){
		position = PJS.getPosition();
	} else {
		try {
		} catch(e){
		}
		PJS.getX = event.pageX;
		PJS.getY = event.pageY;
	}
	this.target.style.left = parseInt(PJS.getOffsetLeft(this.target)+PJS.getX - this.curWidth)+"px";
	this.target.style.top = parseInt(PJS.getOffsetTop(this.target)+PJS.getY - this.curHeight)+"px";
	this.curWidth = PJS.getX;
	this.curHeight = PJS.getY;
};
PJS.dragable.prototype.up = function(evt){
	this.drop();
};
PJS.dragable.prototype.drop = function(){
	this.moveFlag = false;
	PJS.detachEvent(this.dragger,"mousedown",this.drag);
	PJS.detachEvent(document,"mousemove",this.move);
	PJS.detachEvent(document,"mouseup",this.up);
	this.active = false;
};
PJS.dragable.prototype.out = function(){
	PJS.getPosition();
	this.timeout = setTimeout("PJS.dragable._process('"+this.uid+"','drop')",100);
	this.target.style.cursor = "default";
};
PJS.dragable.prototype.addEvent = function(evt,m){
	this.triggers[evt] = m;
};
PJS.dragable.prototype.onEvent = function(evt){
	if(this.triggers && this.triggers[evt] && typeof(this.triggers[evt]) == "function"){
		this.triggers[evt]();
	}
};
PJS.dragable.prototype.stopEvent = function(evt){
	if(PJS.IS_IE){
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	} else {
		evt.preventDefault();
		evt.stopPropagation();
	}
};
PJS.dragable._draggers = Array();
PJS.dragable._add = function(drag){
	PJS.dragable._draggers.push(drag);
};
PJS.dragable._get = function(dragger){
	for(var i=0; i<PJS.dragable._draggers.length; i++){
		if(PJS.dragable._draggers[i].dragger.uid == dragger.uid){
			return PJS.dragable._draggers[i];
		}
	}
	return null;
};
PJS.dragable._remove = function(uid){
	for(var i=0; i<PJS.dragable._draggers.length; i++){
		if(PJS.dragable._draggers[i].uid == uid){
			PJS.dragable._draggers[i] = null;
		}
	}
};
PJS.dragable._start = function(drag){
	for(var i=0; i<PJS.dragable._draggers.length; i++){
		if(PJS.dragable._draggers[i].uid == drag.uid){
			PJS.dragable._draggers[i].target.style.zIndex = 100;
		} else {
			PJS.dragable._draggers[i].target.style.zIndex = 10;
		}
	}
};
PJS.dragable._process = function(uid,action,param){
	for(var i=0; i<PJS.dragable._draggers.length; i++){
		if(PJS.dragable._draggers[i].uid == uid){
			eval("PJS.dragable._draggers[i]."+action+"("+param+")");
		}
	}
};
/////////////////////////////////////////////////////////////////////////////
//PJS.dialog
PJS.dialog = function(){
	this.td = null;
	this.uid = null;
	this.ds = null;
	this.hs = null;
	this.cs = null;
	this.dc = null;
	this.hc = null;
	this.cc = null;
	this.width = 300;
	this.height = 100;
	//
	this.inited = false;
	this.assigned = false;
	this.toggled = true;
	this.center = true;
	this.dragable = true;
	this.footable = false;
	this.largable = false;
	//
	this.xc = function(m,p){
		if(this.xc_url){
			xcb(this.xc_url,m,p);
		} else {
			xc(m,p);
		}
	};
	this.xca = function(a,b){
		xcb("ws/admin/","wsa_"+a,b);
	};
	this.xce = function(a,b){
		xcb("ws/editor/","wse_"+a,b);
	};
	this.xcm = function(a,b){
		xcb("ws/my/","wsm_"+a,b);
	};
	this.xcb = function(url,m,p){
		xcb(url,m,p);
	};
	//
	this.init = function(){
		if(this.inited == true){
			return;
		}
		this.uid = PJS.rand("dialog");
		this.uid_d = "_d_d"+this.uid;
		this.uid_d_h = "_d_d_h"+this.uid;
		this.uid_d_c = "_d_d_c"+this.uid;
		this.uid_d_f = "_d_d_f"+this.uid;
		//
		if(this.td){
			//
		} else {
			PJS.appendDIVHTML(this.uid_d,"","dialog");
			this.td = $E(this.uid_d);
			//PJS.appendDIV(this.td,this.uid_d_h,"dialog_head","");
			//PJS.appendDIV(this.td,this.uid_d_c,"dialog_content","");
			//PJS.appendDIV(this.td,this.uid_d_f,"dialog_foot","");
			var c = '<div class="dialog_inner">';
			c += '<div class="dialog_head">';
			c += '<div class="dialog_close"><a onClick="PJS.dialog._close(\''+this.uid+'\');"> X </a></div>';
			c += '<div class="right dialog_zoom'+(this.largable ? "": " hidden")+'">';
			c += '<a onClick="PJS.dialog._zoom(\''+this.uid+'\');">[+]</a>&nbsp;&nbsp;';
			c += '</div>';
			c += '<div id="'+this.uid_d_h+'"></div>';
			c += '</div>';
			c += '<div class="dialog_contentbox">';
			c += '<div id="'+this.uid_d_c+'" class="dialog_content"></div>';
			c += '</div>';
			c += '<div class="dialog_footbox">';
			c += '<div id="'+this.uid_d_f+'" class="dialog_foot">';
			c += '<input type="button" name="submit" value="Submit" onClick="PJS.dialog._submit(\''+this.uid+'\');">';
			c += '</div>';
			c += '</div>';
			c += '</div>';
			this.td.innerHTML = c;
			this.tdh = $E(this.uid_d_h);
			this.tdc = $E(this.uid_d_c);
			this.tdf = $E(this.uid_d_f);
		}
		this.inited = true;
	};
	//
	this._setHead = function(hc,hs){
		this.hc = hc;
		this.hs = hs;
	};
	this._getHeader = function(){
		return this.hc;
	};
	this._setContent = function(cc,cs){
		this.cc = cc;
		this.cs = cs;
	};
	this._getContent = function(){
		return this.cc;
	};
	this._setFoot = function(r){
		this.footable = r ? true : false;
	};
	this._getFoot = function(r){
		return this.footable;
	};
	this._setWidth = function(w){
		this.width = w;
	};
	this._setHeight = function(h){
		this.height = h;
	};
	this._setSize = function(w,h){
		this.width = w;
		this.height = h;
	};
	this.size = function(x,y){
		this._setSize(w,h);
	};
	this.position = function(x,y){
		this.posx = x;
		this.posy = y;
	};
	//
	this.setLoading = function(){
		
	};
	this.setClassName = function(className){
		this.className = className;
	};
	//content
	this.setHead = function(hc){
		this.init();
		this.tdh.innerHTML = hc;
	};
	this.setContent = function(cc){
		this.init();
		this.tdc.innerHTML = cc;
	};
	//size
	this.setWidth = function(w){
		this.init();
		this._setWidth(w);
		this.td.style.width = this.width+"px";
	};
	this.setHeight = function(h){
		this.init();
		this._setHeight(h);
		this.tdc.style.height = this.height+"px";
	};
	this.setSize = function(w,h){
		this.setWidth(w);
		this.setHeight(h);
	};
	this.setWindow = function(){
		var w = PJS.getScreenWidth();
		var h = PJS.getScreenHeight();
		this.setSize(w,h);
		this.setLocation(0,0);
	};
	this.setWHCH = function(w,h,cc,hc){
		this.setSize(w,h);
		this.setContent(cc);
		this.setHead(hc);
	};
	this.setCenter = function(){
		this.init();
		var w = PJS.getScreenWidth();
		var h = PJS.getScreenHeight();
		var t = PJS.getScrollTop();
		this.td.style.left = parseInt(w/2 - this.width/2)+"px";
		this.td.style.top = parseInt(h/2+t - this.height/2)+"px";
	};
	this.setLocation = function(x,y){
		this.init();
		this.posx = x;
		this.posy = y;
		this.td.style.left = this.posx+"px";
		this.td.style.top = this.posy+"px";
	};
	this.setLocationE = function(el,p){
		this.init();
		if(el){
			var l = PJS.getOffsetLeft(el);
			var t = PJS.getOffsetTop(el);
			var w = PJS.getScreenWidth();
			var h = PJS.getScreenHeight();
			if(l+this.width > w){
				l -= this.width;
			}
			if(t+this.height > h){
				t -= this.height;
			}
			if(p == "bottom"){
				t += PJS.offsetHeight(el);
			} else if(p == "top"){
				t -= PJS.offsetHeight(el);
			}
			this.posx = l;
			this.posy = t;
			this.td.style.left = this.posx+"px";
			this.td.style.top = this.posy+"px";
		}
	};
	this.setStyle = function(p,v){
		this.init();
		PJS.setStyle(this.td,p,v);
	};
	this.setCStyle = function(p,v){
		this.init();
		PJS.setStyle(this.tdc,p,v);
	};
	//
	this._show = function(){
		this.td.style.display = "";
	};
	this._hide = function(){
		this.td.style.display = "none";
	};
	this._showfoot = function(){
		this.tdf.style.display = "";
	};
	this._hidefoot = function(){
		this.tdf.style.display = "none";
	};
	this._toggle = function(){
		if(this.td.style.display == ""){
			this.td.style.display = "none";
		} else {
			this.td.style.display = "";
		}
	};
	//
	this.output = function(s){
		this.init();
		
		if(this.hc == null){
			this.tdh.style.display = "none";
		} else {
			this.tdh.innerHTML = this.hc;
		}
		this.tdc.innerHTML = this.cc;
		if(s){
			this.td.style.display = "";
		}
		if(this.footable == true){
			this.tdf.style.display = "";
		} else {
			this.tdf.style.display = "none";
		}
		if(this.className){
			PJS.addClass(this.td,this.className);
		}
		if(this.width > 0){
			this.td.style.width = this.width+"px";
		}
		if(this.height > 0){
			this.tdc.style.height = this.height+"px";
		}
		if(this.center){
			this.setCenter();
		} else {
			if(this.posx || this.posy){
				this.td.style.left = this.posx+"px";
				this.td.style.top = this.posy+"px";
				this.td.style.position = "absolute";
			} else {
				var evt = PJS.fixEvent();
				var el = PJS.srcElement(evt);
				this.setLocationE(el);
			}
		}
		if(this.dragable){
			var drag = new PJS.dragable();
			drag.register(this.td,this.tdh);
		}
	};
	this.zoom = function(){
		if(this._dz == null) this._dz = 1;
		if(this._dz == 1){
			var z = 2 * this._dz;
		} else if(this._dz > 1){
			var z = this._dz / 4;
		} else if(this._dz < 1){
			var z = this._dz * 4;
		}
		var w = this.width * z;
		var h = this.height * z;
		this.setSize(w,h);
		this._dz = z;
	};
	//
	this.show = function(cc,hc){
		if(this.assigned == true){
			if(this.toggled){
				this._toggle();
			} else {
				this._show();
			}
			return;
		}
		if(isUndefined(hc) == false){
			this._setHead(hc);
		}
		if(cc){
			this._setContent(cc);
		}
		this.output(1);
		//this.setCenter();
		this.assigned = true;
		//_dialogs.push(this);
		PJS.dialog._add(this);
	};
	this.showMessage = function(cc,hc){
		if(this.assigned == false){
			if(this.toggled){
				this._toggle();
			} else {
				this._show();
			}
			return;
		}
		if(isUndefined(hc) == false){
			this._setHead(hc);
		}
		if(cc){
			this._setContent(cc);
		}
		this.output(1);
		//this.setCenter();
		this.assigned = true;
		//_dialogs.push(this);
		PJS.dialog._add(this);
	};
	this.MessageBox = function(cc,hc){
		this.showMessage(cc,hc);
	};
	this.hide = function(){
		PJS.hideE(this.td);
		if(this.onhide){
			this.onhide();
		}
	};
	this.close = function(){
		//this._setHead("");
		//this._setContent("");
		//this.output(1);
		PJS.hideE(this.td);
		if(this.onclose){
			this.onclose();
		}
	};
	this.submit = function(){
		PJS.hideE(this.td);
		if(this.onsubmit){
			this.onsubmit();
		}
	};
	this.clear = function(){
		this.init();
		this.tdc.innerHTML = "";
	};
	//
	this.load = function(a,b,hc){
		this.show("loading...",hc);
		this.xc(a,b);
	};
	this.loada = function(a,b,hc){
		this.show("loading...",hc);
		this.xca(a,b);
	};
	this.loade = function(a,b,hc){
		this.show("loading...",hc);
		this.xce(a,b);
	};
	this.loadm = function(a,b,hc){
		this.show("loading...",hc);
		this.xcm(a,b);
	};
	this.loadb = function(url,a,b,hc){
		this.show("loading...",hc);
		this.xcb(url,a,b);
	};
};
//
PJS.dialog._dialogs = Array();
PJS.dialog._add = function(dialog){
	PJS.dialog._dialogs.push(dialog);
};
PJS.dialog._get = function(uid){
	for(var i=0; i<PJS.dialog._dialogs.length; i++){
		if(PJS.dialog._dialogs[i].uid == uid){
			return PJS.dialog._dialogs[i]
		}
	}
};
PJS.dialog._remove = function(uid){
	for(var i=0; i<PJS.dialog._dialogs.length; i++){
		if(PJS.dialog._dialogs[i].uid == uid){
			PJS.dialog._dialogs[i] = null;
		}
	}
};
PJS.dialog._process = function(uid,action,param){
	for(var i=0; i<PJS.dialog._dialogs.length; i++){
		if(PJS.dialog._dialogs[i].uid == uid){
			eval("PJS.dialog._dialogs[i]."+action+"("+param+")");
		}
	}
};
PJS.dialog._close = function(uid){
	for(var i=0; i<PJS.dialog._dialogs.length; i++){
		if(PJS.dialog._dialogs[i].uid == uid){
			PJS.dialog._dialogs[i].close();
		}
	}
};
PJS.dialog._zoom = function(uid){
	for(var i=0; i<PJS.dialog._dialogs.length; i++){
		if(PJS.dialog._dialogs[i].uid == uid){
			PJS.dialog._dialogs[i].zoom();
		}
	}
};
PJS.dialog._submit = function(uid){
	for(var i=0; i<PJS.dialog._dialogs.length; i++){
		if(PJS.dialog._dialogs[i].uid == uid){
			PJS.dialog._dialogs[i].submit();
		}
	}
};
//dialogs
var _dialogs = Array();
function _dialog_add(dialog){
	_dialogs.push(dialog);
};
function _dialog_get(uid){
	for(var i=0; i<_dialogs.length; i++){
		if(_dialogs[i].uid == uid){
			return _dialogs[i];
		}
	}
	return null;
};
function _dialog_remove(uid){
	for(var i=0; i<_dialogs.length; i++){
		if(_dialogs[i].uid == uid){
			_dialogs[i] = null;
		}
	}
};
function _dialog_process(uid,action,param){
	for(var i=0; i<_dialogs.length; i++){
		if(_dialogs[i].uid == uid){
			eval("_dialogs[i]."+action+"("+param+")");
		}
	}
};
function _dialog_close(uid){
	for(var i=0; i<_dialogs.length; i++){
		if(_dialogs[i].uid == uid){
			_dialogs[i].close();
		}
	}
};
/////////////////////////////////////////////////////////////////////////////
//PJS.cart
PJS.cart = {
	xc: function(m,p){
		xcb("ws/cart/",m,p);
	},
	getcart: function(t){
		if($E(t)) PJS.cart.dtoE = t;
		PJS.cart.xc("cart_product_get");
	},
	addcart: function(pid,q,a,t){
		if(isUndefined(q)) q = 1;
		if(isUndefined(a)) a = "";
		if(isUndefined(t)) t = "";
		PJS.cart.xc("cart_product_add",[pid,q,a,t]);
	},
	addcartform: function(formname){
		var form = document.forms[formname];
		form.id = PJS.rand("cartform");
		PJS.cart.xc("cart_product_addsd",[xcgfm(form.id)]);
		//var atcrd = $E("addtocartresultdiv");
		//if(atcrd){
		//	atcrd.innerHTML = '<span class="status">adding product to cart</span>';
		//}
	},
	addproduct: function(pid,pmin,pmax,eid){
		var el = null;
		if(isUndefined(eid)) eid = "cart_add_quantity";
		if(eid && $E(eid)){
			el = $E(eid);
		}
		if(el){
			if(el.value == "" || el.value < 1){
				alert("Enter Order Quantity");
				return false;
			} else {
				var q = el.value;
			}
		} else {
			var q = 1;
		}
		q = parseInt(q);
		pmin = parseInt(pmin);
		pmax = parseInt(pmax);
		if(pmin > 0 && q<pmin){
			alert("Order Min Quantity is "+pmin);
			return false;
		} else if(pmax > 0 && q > pmax){
			alert("Order Max Quantity is "+pmax);
			return false;
		}
		PJS.cart.xc("cart_product_add",[pid,q]);
		//if(!$E("topcart")){
		//	PJS.appendDIV($E("topcontent"),"topcart");
		//	$E("topcart").innerHTML = '<a href="'+PJS.BASE_URL+'cart.html'+'">Shopping Cart</a>';
		//}
	},
	apc: function(pid){
		var q = el.value;
		PJS.cart.xc("cart_product_add",[pid,q]);
	},
	apcbstk: function(pid,q,a){
		if(confirm("No Much Stock Quantity! Add To Cart?")){
			PJS.cart.addcart(pid,q,a,"1");
		}
	},
	apcb: function(r){
		if(r.err == 0){
			//
			if(r.cart && r.cart.count >= 0){
				if($E("topcartinfo")){
					$E("topcartinfo").innerHTML = r.cart.count+" item(s): $"+r.cart.price;
				}
			}
			//
			if(r.type == "alert"){
				if(r.msg && r.content == ""){
					alert(r.msg);
					return;
				}
			} else if(r.type == "tip"){
				var atcrd = $E("addtocartresultdiv");
				if(atcrd){
					atcrd.innerHTML = '<span class="status">item has added to cart</span>';
					PJS.action.delay_clean(atcrd,2000);
				}
			} else if(r.type == "div"){
				var atcrd = $E("addtocartresultdiv");
				if(atcrd){
					atcrd.innerHTML = r.content;
					atcrd.style.display = "";
					
				}
				var atcd = $E("addtocartdiv");
				if(atcd){
					atcd.style.display = "none";
				}
			} else if(r.type == "dialog"){
				//dialog.show(r.content,r.msg);
				if(typeof(PJS.cart.dcart) == "undefined"){
					PJS.cart.dcart = new PJS.dialog;
					PJS.cart.dcart.toggled = false;
				}
				PJS.cart.dcart._setSize(360,150);
				//PJS.cart.dcart._setFoot(true);
				PJS.cart.dcart._setHead(r.title);
				if(PJS.cart.dtoE){
					PJS.cart.dcart.center = false;
					PJS.cart.dcart.setLocationE($E(PJS.cart.dtoE),"bottom");
				}
				PJS.cart.dcart.show();
				PJS.cart.dcart.setContent(r.content);
			} else {
				alert(r.msg);
			}
		} else {
			alert(r.msg);
		}
	},
	apcr: function(){
		if(typeof(PJS.cart.dcart) != "undefined"){
			PJS.cart.dcart.close();
			if(PJS.cart.dtoE){
				PJS.cart.dtoE = "";
			}
		} else {
			var atcrd = $E("addtocartresultdiv");
			if(atcrd){
				var atcd = $E("addtocartdiv");
				if(atcd){
					atcd.style.display = "";
				}
				atcrd.style.display = "none";
				atcrd.innerHTML = "";
			}
		}
	},
	updatecart: function(obj){
		var pid = str_replace("pid","",obj.value);
		var q = obj.value;
		PJS.cart.xc("cart_product_update",[pid,q]);
	},
	checkNumber: function(obj){
		var pid = str_replace("pid_","",obj.id);
		var q = obj.value;
		var pmin = obj.getAttribute("pmin");
		var pmax = obj.getAttribute("pmax");
		var pqct = $E("c_p_"+pid+"_qct");
		q = parseInt(q);
		pmin = parseInt(pmin);
		pmax = parseInt(pmax);
		if(pmin > 0 && q<pmin){
			if(pqct){
				pqct.innerHTML = "Order Min Quantity is "+pmin;
			} else {
				alert("Order Min Quantity is "+pmin);
			}
			return false;
		} else if(pmax > 0 && q > pmax){
			if(pqct){
				pqct.innerHTML = "Order Max Quantity is "+pmax;
			} else {
				alert("Order Max Quantity is "+pmax);
			}
			return false;
		}
		pqct.innerHTML = "";
		if(pid.length > 0){
			//PJS.cart.xc("cart_product_update",[pid,q]);
		}
		return true;
	},
	checkCartNumber: function(form){
		var b = true;
		var bb = true;
		var a = form.getElementsByTagName("INPUT");
		for(var i=0; i<a.length; i++){
			if(a[i].name.substring(0,3) == "pid" && a[i].id.substring(0,4) == "pid_"){
				b = PJS.cart.checkNumber(a[i]);
				if(b == false){
					bb = false;
				}
			}
		}
		return bb;
	},
	updatecartnums: function(){
		if($E("cart_products_nums")){
			$E("cart_products_nums").innerHTML = "New";
		}
	},
	deleteproduct: function(pid){
		PJS.cart.xc("cart_product_delete",[pid]);
	},
	updatetotalprice: function(value){
		if($E("c_p_totalprice")){
			$E("c_p_totalprice").innerHTML = value;
		}
	},
	hideproduct: function(pid){
		if($E("c_p_"+pid)){
			$E("c_p_"+pid).innerHTML = "";
		}
	},
	hideproducts: function(){
		if($E("c_p_all")){
			$E("c_p_all").innerHTML = "";
		}
	},
	removeall: function(){
		
	},
	refresh: function(){
		PJS.goto("cart/");
	},
	calcshippingcartups: function(){
		var z = $E("cs_zone").value;
		var p = $E("cs_postcode").value;
		var s = $E("cs_service").value;
		PJS.cart.xc("cart_calcshipping_cart",[[z,p,s]]);
	},
	calcshippingcartupscb: function(s,r){
		$E("c_p_shippingprice").innerHTML = "$"+s.cost;
		$E("c_p_totalprice").innerHTML = "$"+r.total_price;
	},
	calcshippingcart: function(){
		var z = $E("cs_zone").value;
		var p = $E("cs_postcode").value;
		var s = $E("cs_method").value;
		PJS.cart.xc("cart_calcshipping_cart",[[z,p,s]]);
	},
	calcshippingcartcb: function(s,r){
		$E("c_p_shippingprice").innerHTML = "$"+s.cost;
		$E("c_p_totalprice").innerHTML = "$"+r.total_price;
	},
	applycoupon: function(code){
		if(code != ""){
			PJS.cart.xc("cart_coupon_apply",[code]);
		} else {
			alert("Enter coupon code");
			return false;
		}
	},
	removecoupon: function(){
		PJS.cart.xc("cart_coupon_remove");
	}
};
/////////////////////////////////////////////////////////////////////////////
//PJS.account
PJS.account = {
	logged: false,
	userid: "",
	username: "",
	contact: "",
	usertype: "",
	usergid: "",
	
	//action
	dologin: function(p,t){
		if(isUndefined(p)) p = "account";
		if(isUndefined(t)) t = "common_leftcolumn";
		p = p+" ";
		if(!$E(p+"username") || !$E(p+"password")){
			return false;
		}
		var tu = $E(p+"username");
		var tp = $E(p+"password");
		var u = tu.value;
		var p = tp.value;
		var r = 0;
		if($E(p+"rememberme")){
			var r = $E(p+"rememberme").checked == true ? 1: 0;
		}
		if(str_length(u) == 0){
			alert("Enter your username");
			tu.focus();
			return false;
		}
		if(str_length(p) == 0){
			alert("Enter your password");
			tp.focus();
			return false;
		}
		//tp.value = "";
		xc("account_dologin",[u,p,r,t]);
	},
	dologout: function(){
		var u = PJS.account.username;
		xc("account_dologout",[u]);
	},
	onlogin: function(r){
		if(r.value == 1){
			if(r.tid && r.content && $E(r.tid)){
				//$E(r.tid).innerHTML = r.content;
				//alert("Login Successfully!");
				PJS.refresh();
			} else {
				//alert("Login Successfully!");
				PJS.refresh();
			}
		} else if(r.value == 0){
			alert("Failed");
		}
	},
	onlogout: function(r){
		
	},
	my: function(user){
		PJS.account.userid = user.userid;
		PJS.account.username = user.username;
		PJS.account.contact = user.contact;
		PJS.account.usertype = user.usertype;
		PJS.account.usergid = user.usergid;
	},
	call: function(){
		PJS.account.get();
	},
	get: function(){
		xc("account_get");
	},
	getcb: function(r){
		PJS.account.m(r);
	},
	checkcode: function(){
		if(PJS.account._checkstatus == 2){
			return true;
		}
		//
		if(PJS.account._checkstatus != 1){
			var code = $E("account_checkcode").value;
			PJS.account.docheckcode(code);
			PJS.account._timer = window.setInterval(function(){PJS.account.checkcode();},1000);
			PJS.account._checkstatus = 1;
		}
		return false;
	},
	docheckcode: function(code){
		xc("account_docheckcode",[code]);
	},
	oncheckcode: function(r){
		PJS.account._checkstatus = 2;
		window.clearInterval(PJS.account._timer);
	}
};
//PJS.account.get();
/////////////////////////////////////////////////////////////////////////////
//PJS.validator
PJS.validator = function(){};
PJS.validator.registerFormAction = function(){
	//common form validate
	if(arguments.length > 1){
		var forms = arguments;
	} else if(arguments.length == 1){
		var forms = [arguments[0]];
	} else {
		var forms = document.forms;
	}
	for(var i=0; i<forms.length; i++){
		if((forms[i].method == "post" || forms[i].method == "get") && (isUndefined(forms[i].onsubmit) || forms[i].onsubmit == null)){
			var fm = forms[i];
			fm.onsubmit = function(){
					var form = this;
					return PJS.validator.checkFormValid(form);
						};
			for(var j=0; j<fm.elements.length; j++){
				fm.elements[j].onblur = function(){
					var element = this;
					return PJS.validator.checkElementValid(element);
						};
			}
		}
	}
};
PJS.validator.checkElementValid = function(element){
	var form_element_msg = [];
	var vfs = [];
	var berr = false;
	var v = element.getAttribute("valid");
	var _v = element.getAttribute("_valid");
	if(v && (_v == null || _v == 1) && (isUndefined(element.diabled) || element.diabled == false)){
		var vs = v.split(",");
		for(var j in vs){
			v = vs[j];
			switch(v){
				case "number":
					if(element.value == ""){
					} else if(IsNumeric(element.value) == false){
						form_element_msg.push("The field must be number");
						PJS.addClass(element,"form-element-error");
						berr = true;
					}
					break;
				case "decimal":
				case "percent":
					if(element.value == ""){
						form_element_msg.push("The field must be decimal");
						PJS.addClass(element,"form-element-error");
						berr = true;
					} else if(IsDecimal(element.value) == false){
						form_element_msg.push("The field must be decimal");
						PJS.addClass(element,"form-element-error");
						berr = true;
					}
					break;
				case "float":
					if(element.value == ""){
					} else if(IsFloat(element.value) == false){
						form_element_msg.push("The field must be float");
						PJS.addClass(element,"form-element-error");
						berr = true;
					}
					break;
				case "price":
					if(element.value == ""){
					} else if(IsFloat(element.value) == false){
						form_element_msg.push("The field must be price");
						PJS.addClass(element,"form-element-error");
						berr = true;
					}
					break;
				case "time":
					break;
				case "email":
					if(element.value == ""){
						form_element_msg.push("The field must be email address");
						PJS.addClass(element,"form-element-error");
						berr = true;
					} else if(PJS.checkEmail(element.value) == false){
						form_element_msg.push("The field must be a valid email address");
						PJS.addClass(element,"form-element-error");
						berr = true;
					}
					break;
				case "require":
				case "notnull":
				case "not_null":
					if(element.type == "checkbox" && element.checked == false){
						var msg = element.getAttribute("valid_"+v+"_msg");
						if(!msg) msg = "The field is required";
						form_element_msg.push(msg);
						return false;
					} else if(element.value == "" || element.value == "0"){
						var msg = element.getAttribute("valid_"+v+"_msg");
						if(!msg) msg = "The field is required";
						form_element_msg.push(msg);
						PJS.addClass(element,"form-element-error");
						berr = true;
					}
					break;
			}
		}
		if(berr==false){
			PJS.removeClass(element,"form-element-error");
		}
	} else if(v){
		//
	} else if(element.getAttribute("require") == "true" || element.getAttribute("require") == "1"){
		if(element.tagName.toUpperCase() == "SELECT"){
			if(element.value == ""){
				form_element_msg.push("The field must be selected");
				PJS.addClass(element,"form-element-error");
				berr = true;
			} else {
				PJS.removeClass(element,"form-element-error");
			}
		} else if(element.tagName.toUpperCase() == "INPUT"){
			if(element.type.toUpperCase() == "CHECKBOX" || element.type.toUpperCase() == "RADIO"){
				var en = element.name;
				if(PJS.list.hasSelected(element,en) == false){
					form_element_msg.push("The field must be selected");
					PJS.addClass(element.parentNode,"form-element-error");
					berr = true;
				} else {
					PJS.removeClass(element.parentNode,"form-element-error");
				}
			} else {
				if(element.value == ""){
					form_element_msg.push("The field must be entered");
					PJS.addClass(element,"form-element-error");
					berr = true;
				} else {
					PJS.removeClass(element,"form-element-error");
				}
			}				
		} else {
			vfs.push(element.name);
		}
	}
	
	return berr;
};
PJS.validator.checkFormValid = function(form){
	var form_element_focus = null;
	var form_element_msg = [];
	var checkbefore = form.getAttribute("checkbefore");
	var checkafter = form.getAttribute("checkafter");
	if(checkbefore != ""){
		var _ca = eval(checkbefore);
		if(_ca == false){
			return false;
		}
	}
	if(form.field_name && form.field_name.value == ""){
		form_element_msg.push("Please enter the name");
		form.field_name.focus();
		return false;
	} else if(form.field_subject && form.field_subject.value == ""){
		form_element_msg.push("Please enter the subject");
		form.field_subject.focus();
		return false;
	}
	if(form.category && form.field_category){
		if(form.field_category.value == "" && form.category.value == ""){
			form_element_msg.push("Please enter the category or select one");
			form.category.focus();
			return false;
		}
	}
	if(form.group && form.field_group){
		if(form.field_group.value == "" && form.group.value == ""){
			form_element_msg.push("Please enter the group or select one");
			form.group.focus();
			return false;
		}
	}
	/*
	if(form.field_email_address){
		if(form.field_email_address.value == ""){
			form.field_email_address.focus();
			return false;
		} else if(PJS.checkEmail(form.field_email_address.value) == false){
			//form.field_email_address.select();
			form.field_email_address.focus();
			return false;
		}
	}
	*/
	if(form.field_start_time && form.field_end_time && form.field_end_time.value.length > 0){
		if(form.field_start_time.value >= form.field_end_time.value){
			form_element_msg.push("The start time field must be before the end time");
			//form.field_end_time.focus();
			return false;
		}
	} else if(form.date_from && form.date_to && form.date_to.value.length > 0){
		if(form.date_from.value > form.date_to.value){
			form_element_msg.push("The start time field must be before the end time");
			form.date_from.focus();
			return false;
		}
	}
	if(form.field_sort_order && IsNumeric(form.field_sort_order.value) == false){
		form_element_msg.push("The sort order field must be number");
		form.field_sort_order.focus();
		return false;
	}
	var vfs = [];
	var berr = false;
	for(var i=0; i<form.elements.length; i++){
		var v = form.elements[i].getAttribute("valid");
		var _v = form.elements[i].getAttribute("_valid");
		if(v && (_v == null || _v == 1) && (isUndefined(form.elements[i].diabled) || form.elements[i].diabled == false)){
			var vs = v.split(",");
			for(var j in vs){
				v = vs[j];
				switch(v){
					case "number":
						if(form.elements[i].value == ""){
						} else if(IsNumeric(form.elements[i].value) == false){
							form_element_msg.push("The field must be number");
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						}
						break;
					case "decimal":
					case "percent":
						if(form.elements[i].value == ""){
							form_element_msg.push("The field must be decimal");
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						} else if(IsDecimal(form.elements[i].value) == false){
							form_element_msg.push("The field must be decimal");
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						}
						break;
					case "float":
						if(form.elements[i].value == ""){
						} else if(IsFloat(form.elements[i].value) == false){
							form_element_msg.push("The field must be float");
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						}
						break;
					case "price":
						if(form.elements[i].value == ""){
						} else if(IsFloat(form.elements[i].value) == false){
							form_element_msg.push("The field must be price");
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						}
						break;
					case "time":
						break;
					case "email":
						if(form.elements[i].value == ""){
							form_element_msg.push("The field must be email address");
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						} else if(PJS.checkEmail(form.elements[i].value) == false){
							form_element_msg.push("The field must be a valid email address");
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						}
						break;
					case "require":
					case "notnull":
					case "not_null":
						if(form.elements[i].type == "checkbox" && form.elements[i].checked == false){
							var msg = form.elements[i].getAttribute("valid_"+v+"_msg");
							if(!msg) msg = "The field is required";
							form_element_msg.push(msg);
							return false;
						} else if(form.elements[i].value == "" || form.elements[i].value == "0"){
							var msg = form.elements[i].getAttribute("valid_"+v+"_msg");
							if(!msg) msg = "The field is required";
							form_element_msg.push(msg);
							if(form_element_focus == null ) form_element_focus = form.elements[i];
							PJS.addClass(form.elements[i],"form-element-error");
							berr = true;
						}
						break;
				}
			}
		} else if(v){
			//
		} else if(form.elements[i].getAttribute("require") == "true" || form.elements[i].getAttribute("require") == "1"){
			if(form.elements[i].tagName.toUpperCase() == "SELECT"){
				if(form.elements[i].value == ""){
					if(form_element_focus == null ) form_element_focus = form.elements[i];
					form_element_msg.push("The field must be selected");
					PJS.addClass(form.elements[i],"form-element-error");
					berr = true;
				} else {
					PJS.removeClass(form.elements[i],"form-element-error");
				}
			} else if(form.elements[i].tagName.toUpperCase() == "INPUT"){
				if(form.elements[i].type.toUpperCase() == "CHECKBOX" || form.elements[i].type.toUpperCase() == "RADIO"){
					var en = form.elements[i].name;
					if(PJS.list.hasSelected(form.elements[i],en) == false){
						if(form_element_focus == null ) form_element_focus = form.elements[i];
						form_element_msg.push("The field must be selected");
						PJS.addClass(form.elements[i].parentNode,"form-element-error");
						berr = true;
					} else {
						PJS.removeClass(form.elements[i].parentNode,"form-element-error");
					}
				} else {
					if(form.elements[i].value == ""){
						if(form_element_focus == null ) form_element_focus = form.elements[i];
						form_element_msg.push("The field must be entered");
						PJS.addClass(form.elements[i],"form-element-error");
						berr = true;
					} else {
						PJS.removeClass(form.elements[i],"form-element-error");
					}
				}				
			} else {
				vfs.push(form.elements[i].name);
			}
		}
	}
	if(form_element_focus != null){
		form_element_focus.focus();
	}
	if(form_element_msg.length > 0){
		//alert(form_element_msg[0]);
	}
	if(berr == true){
		return false;
	}
	var r = validator_form(form,vfs);
	if(r == false){
		return false;
	}
	if(checkafter != ""){
		var _ca = eval(checkafter);
		if(_ca == false){
			return false;
		}
	}
	return true;
};
/////////////////////////////////////////////////////////////////////////////
//PJS.onload
PJS.onload = function(){};
PJS.onload.preloadImages = function(){
	var d = document;
	if(d.images){
		//pms
		var i,j,a;
		if(!d._PMS){
			d._PMS = new Array();
			j = d._PMS.length;
			a = document.getElementsByTagName("IMG");
			for(i=0; i<a.length; i++){
				if(a[i].className == "pm"){
					if(a[i].src.indexOf(".jpg") > -1 && a[i].src.substring(0,a[i].src.indexOf(".jpg")).length > 0){
						d._PMS[j] = new Image;
						d._PMS[j++].src = a[i].src.substring(0,a[i].src.indexOf(".jpg"))+"_2.jpg";
					} else if(a[i].src.indexOf(".gif") > -1 && a[i].src.substring(0,a[i].src.indexOf(".gif")).length > 0){
						d._PMS[j] = new Image;
						d._PMS[j++].src = a[i].src.substring(0,a[i].src.indexOf(".gif"))+"_2.gif";
					}
				}
			}
		}
	}
};
PJS.onload.registerImageAction = function(){
	//attachimage
	var images = document.images;
	for(var i=0; i<images.length; i++){
		if(images[i].className == "pm"){
			PJS.addEvent(images[i],"mouseover",
						function(evt){
							var el = PJS.srcElement(evt);
							if(el.tagName.toUpperCase() == "IMG"){
								if(el.src.indexOf(".jpg") > -1){
									el.src = el.src.substring(0,el.src.indexOf(".jpg"))+"_2.jpg";
								} else if(el.src.indexOf(".gif") > -1){
									el.src = el.src.substring(0,el.src.indexOf(".gif"))+"_2.gif";
								}
							}
						});
			PJS.addEvent(images[i],"mouseout",
						function(evt){
							var el = PJS.srcElement(evt);
							if(el.tagName.toUpperCase() == "IMG"){
								el.src = el.src.replace("_2","");
							}
						});
		} else if(images[i].className == "attachimage"){
			if(images[i].width > 500){
				images[i].height = parseInt((images[i].height / images[i].width) * 500);
				images[i].width = 500;
			}
		} else if(images[i].className == "pimage"){
			if(images[i].width > 10){
				var r = images[i].height / images[i].width;
				if(r > 1){
					images[i].width = parseInt(images[i].width * 120 / images[i].height);
					images[i].height = 120;
				} else {
					images[i].height = parseInt(images[i].height * 120 / images[i].width);
					images[i].width = 120;
				}
			}
		}
	}
};
//
PJS.onload.listBoxAction = function(){
	var a = document.getElementsByTagName("TABLE");
	for(var i=0;i<a.length; i++){
		if(a[i].className.indexOf("listBox") > -1 && a[i].className.indexOf("nolight") == -1){
			var b = a[i].getElementsByTagName("TR");
			if(b.length > 0){
				var k = 0;
				for(var j=0;j<b.length; j++){
					if(PJS.noClass(b[j]) || PJS.hasClass(b[j],["Action","Head"],1) == false){
						if(PJS.hasAttr(b[j],"id") == false){
							if(k/2 == parseInt(k/2)){
								PJS.addClass(b[j],"row0");
							} else {
								PJS.addClass(b[j],"row1");
							}
							k++;
							//PJS.attachEvent(b[j],"mouseover",function(evt){PJS.addClass(PJS.getParent(PJS.srcElement(evt),"TR"),"rowover");});
							//PJS.attachEvent(b[j],"mouseout",function(evt){PJS.removeClass(PJS.getParent(PJS.srcElement(evt),"TR"),"rowover");});
							var el = PJS.getElements(b[j],"INPUT","cb")[0];
							if(el){
								PJS.attachEvent(el,"change",function(evt){
														var el = PJS.srcElement(evt);
														if(el.checked){
															PJS.addClass(PJS.getParent(el,"TR"),"rowover");
														} else {
															PJS.removeClass(PJS.getParent(el,"TR"),"rowover");
														}
															 });
							}
						}
					}
				}
			}
		}
	}
};
//
PJS.onload.cart = function(el){
	var c = getCookie("_pcart");
	//var cc = getCookie("_pcc");
	//var ct = getCookie("_pct");
	if(c.indexOf("-") > -1){
		var cs = c.split("-");
		var cc = cs[1];
		var ct = cs[2];
		$E(el).innerHTML = cc+" item(s): $"+ct;
	}
};
//
PJS.onload.user = function(el){
	if(typeof(PJS.onload.onUser) == "function"){
		PJS.onload.onUser(el,getCookie("_pustatus"));
		return false;
	}
	var un = getCookie("_puname");
	var uc = getCookie("_pucompany");
	$E(el).innerHTML = "Welcome,"+unescape(decodeURIComponent(uc))+"!";
};
//
PJS.onload.registerAction = function(){
	PJS.onload.preloadImages();
	PJS.onload.registerImageAction();
	PJS.onload.listBoxAction();
	
	PJS.validator.registerFormAction();
};
/////////////////////////////////////////////////////////////////////////////
var dialog = new PJS.dialog;
//onload
window.onload = function(){
	//
	//PJS.tip.init();
	PJS.onload.registerAction();
	PJS.cssJsMenu("topmenu");
	//
	//PJS.addScriptAlone("js/category.js");
};
/////////////////////////////////////////////////////////////////////////////